# Maintainer: Natanael Copa <ncopa@alpinelinux.org>
pkgname=cdrkit
pkgver=1.1.11
pkgrel=2
pkgdesc="Suite of programs for CD/DVD recording, ISO image creation, and audio CD extraction"
url="http://cdrkit.org/"
arch="all"
options="!check"  # No test suite.
license="GPL-2.0"
depends="file bzip2"
makedepends="cmake libcap-dev bzip2-dev zlib-dev"
subpackages="$pkgname-doc"
source="https://dev.alpinelinux.org/archive/cdrkit/$pkgname-$pkgver.tar.gz"

prepare() {
	cd "$builddir"
	# disable rcmd, it is security risk and not implemented in musl
	sed -i include/xconfig.h.in -e "s/#define HAVE_RCMD 1/#undef HAVE_RCMD/g"
	default_prepare
}

build() {
	cd "$builddir"
	case "$CLIBC" in
	musl) export CFLAGS="$CFLAGS -D__THROW=''" ;;
	esac
	make
}

package() {
	cd "$builddir"
	make PREFIX="$pkgdir/usr" install
	cd "$pkgdir/usr/bin"
	ln -s wodim cdrecord
	ln -s readom readcd
	ln -s genisoimage mkisofs
	ln -s genisoimage mkhybrid
	ln -s icedax cdda2wav
	cd "$pkgdir/usr/share/man/man1"
	ln -s wodim.1 cdrecord.1
	ln -s readom.1 readcd.1
	ln -s genisoimage.1 mkisofs.1
	ln -s genisoimage.1 mkhybrid.1
	ln -s icedax.1 cdda2wav.1
}

sha512sums="e5afcd2cb68d39aeff680a0d5b0a7877f94cf6de111b3cb7388261c665fbd3209ce98a20a01911875af7d6b832a156801b1fa46a4481f7c8ba60b22eac0a5b05  cdrkit-1.1.11.tar.gz"
